require(['bbcare'], function($bb) {
    var URL = $bb.baseUrl("followup")
    var vm = new Vue({
        el: '.wrapper',
        data: function() {
            return {
                date: [],
                tableData: []
            }
        },
        created: function () {
            this.getQueueList();
            var that = this;
            if (window.export_timer) clearInterval(window.export_timer);
            window.export_timer = setInterval(function () {
                that.getQueueList();
            }, 5000);
        },
        methods: {
            /**
             * 获取需导出的患者队列 
             */
            getQueueList: function () {
                var that = this
                $bb.ajax({
                    url: URL + 'followup/export/query',
                    dataType: 'json',
                    contentType: 'application/json; charset=utf-8',
                    success: function (res) {
                        that.tableData = res.data;
                    }
                })
            },
            /**
             * 点击下载
             * @param { object } row
             */
            handleDownLoad: function (row) {
                var a = document.createElement('a');
                var src = 'http://' + location.host + '/download/export/' + row.excelFilename + '?sessionId=' + sessionStorage.getItem('sessionId');
                var content = row.queueName + '| ' + row.startDate + '-' + row.endDate + ' 数据.xlsx'
                a.setAttribute('href', src);
                a.setAttribute('download', content);
                a.click()
            }
        }
    })
})